import { defHttp } from "@/utils/http";
// ERP 库存盘点单 VO
export interface StockCheckVO {
	id: number; // 出库编号
	no: string; // 出库单号
	outTime: Date; // 出库时间
	totalCount: number; // 合计数量
	totalPrice: number; // 合计金额，单位：元
	status: number; // 状态
	remark: string; // 备注
}

// ERP 库存盘点单 API
export const StockCheckApi = {
	// 查询库存盘点单分页
	getStockCheckPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/invt-mcheck/page`, params });
	},

	// 查询库存盘点单详情
	getStockCheck: async (id: number) => {
		return await defHttp.get({ url: `/whs/invt-mcheck/get?id=` + id });
	},

	// 新增库存盘点单
	createStockCheck: async (data: StockCheckVO) => {
		return await defHttp.post({ url: `/whs/invt-mcheck/create`, data });
	},

	// 修改库存盘点单
	updateStockCheck: async (data: StockCheckVO) => {
		return await defHttp.put({ url: `/whs/invt-mcheck/update`, data });
	},

	// 更新库存盘点单的状态
	updateStockCheckStatus: async (id: number, status: string) => {
		return await defHttp.put({
			url: `/whs/invt-mcheck/update-status`,
			params: {
				id,
				status
			}
		});
	},

	// 删除库存盘点单
	deleteStockCheck: async (ids: number[]) => {
		return await defHttp.delete({
			url: `/whs/invt-mcheck/delete`,
			params: ids
		});
	},

	// 导出库存盘点单 Excel
	exportStockCheck: async (params: any) => {
		return await defHttp.download({ url: `/whs/invt-mcheck/export-excel`, params });
	}
};
